{extend name="base" /}


{block name="main"}
{php}
$empty = "<tr><td colspan='99'>no data</td></tr>";
{/php}
<div class="container">
    <div class="row">
        <div class="col-md-12">

            <a class="btn btn-primary mb-4" href="{:url('admin/addSp')}">Add</a>

            <table class="table table-bordered">
                <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">name</th>
                    <th scope="col">desc</th>
                    <th scope="col">area</th>
                    <th scope="col">Edit</th>
                    <th scope="col">Action</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo" empty="$empty"}
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.name}</td>
                    <td>{$vo.desc}</td>
                    <td>{$vo.area}</td>
                    <td>
                        <a href="{:url('admin/upSp',['id'=>$vo.id])}" class="btn btn-sm btn-success">edit</a>
                    </td>
                    <td>
                        <a href="{:url('admin/addChild',['id'=>$vo.id,'action'=>'hotel'])}" class="btn btn-sm btn-secondary">add hotel</a>
                        <a href="{:url('admin/addChild',['id'=>$vo.id,'action'=>'catering'])}" class="btn btn-sm btn-secondary">add catering</a>
                        <a href="{:url('admin/addChild',['id'=>$vo.id,'action'=>'activity'])}" class="btn btn-sm btn-secondary">add activity</a>
                        <a href="{:url('admin/addChild',['id'=>$vo.id,'action'=>'material'])}" class="btn btn-sm btn-secondary">add material</a>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="5">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <td>hotel</td>
                                <td>
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <td>pic</td>
                                            <td>name</td>
                                            <td>code</td>
                                            <td>num</td>
                                            <td>Edit</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {volist name="vo.hotels" id="voo" empty="$empty"}
                                        <tr>
                                            <td><img src="{$voo.pic}" width="100"></td>
                                            <td>{$voo.name}</td>
                                            <td>{$voo.code}</td>
                                            <td>{$voo.num}</td>
                                            <td>
                                                <a href="{:url('admin/upChild',['id'=>$vo.id,'type'=>'hotel'])}" class="btn btn-sm btn-success">edit</a>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>catering</td>
                                <td>
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <td>name</td>
                                            <td>pic</td>
                                            <td>Edit</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {volist name="vo.caterings" id="voo" empty="$empty"}
                                        <tr>
                                            <td>{$voo.name}</td>
                                            <td><img src="{$voo.pic}" width="100"></td>
                                            <td>
                                                <a href="{:url('admin/upChild',['id'=>$voo.id,'type'=>'catering'])}" class="btn btn-sm btn-success">edit</a>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>activity</td>
                                <td>
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <td>name</td>
                                            <td>start</td>
                                            <td>end</td>
                                            <td>Edit</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {volist name="vo.activitys" id="voo" empty="$empty"}
                                        <tr>
                                            <td>{$voo.name}</td>
                                            <td>{$voo.start}</td>
                                            <td>{$voo.end}</td>
                                            <td>
                                                <a href="{:url('admin/upChild',['id'=>$voo.id,'type'=>'activity'])}" class="btn btn-sm btn-success">edit</a>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>material</td>
                                <td>
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <td>pic</td>
                                            <td>name</td>
                                            <td>num</td>
                                            <td>Edit</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {volist name="vo.materials" id="voo" empty="$empty"}
                                        <tr>
                                            <td><img src="{$voo.pic}" width="100"></td>
                                            <td>{$voo.name}</td>
                                            <td>{$voo.num}</td>
                                            <td>
                                                <a href="{:url('admin/upChild',['id'=>$voo.id,'type'=>'material'])}" class="btn btn-sm btn-success">edit</a>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
        </div>
    </div>
</div>

{/block}